<%-- 
    Document   : servfunc
    Created on : 20/06/2012, 16:40:44
    Author     : Fatec
--%>


<%@page import="java.util.List"%>
<%@page import="br.com.gestaoFuneraria.modelo.servicoFunerario"%>
<%@page import="br.com.gestaoFuneraria.DAO.ServfunDAO"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en"><head>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8">
        <meta charset="utf-8">
        <title>SkyLine</title>
        <script>
            function di(){
                var frsf = document.forms.frmsf;
                frsf.action = "cadastroSF";
                frsf.submit();

            }
        </script>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="">
        <meta name="author" content="">

        <!-- Le styles -->
        <link href="arquivos/bootstrap.css" rel="stylesheet">
        <style type="text/css">
            body {
                padding-top: 60px;
                padding-bottom: 40px;
            }
            .sidebar-nav {
                padding: 9px 0;
            }
        </style>
        <link href="arquivos/bootstrap-responsive.css" rel="stylesheet">

        <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
        <!--[if lt IE 9]>
          <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->

        <!-- Le fav and touch icons -->
        <link rel="shortcut icon" href="Imgs/ico.jpg">
        <link rel="apple-touch-icon-precomposed" sizes="144x144" href="http://twitter.github.com/bootstrap/assets/ico/apple-touch-icon-144-precomposed.png">
        <link rel="apple-touch-icon-precomposed" sizes="114x114" href="http://twitter.github.com/bootstrap/assets/ico/apple-touch-icon-114-precomposed.png">
        <link rel="apple-touch-icon-precomposed" sizes="72x72" href="http://twitter.github.com/bootstrap/assets/ico/apple-touch-icon-72-precomposed.png">
        <link rel="apple-touch-icon-precomposed" href="http://twitter.github.com/bootstrap/assets/ico/apple-touch-icon-57-precomposed.png">
    </head>

    <body>

        <div class="navbar navbar-fixed-top">
            <div class="navbar-inner">
                <div class="container-fluid">
                    <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </a>
                    <a class="brand" href="index.jsp"> SkyLine </a>

                    <!--          <div class="btn-group pull-right">
                                <ul class="dropdown-menu">
                                  <li><a href="#">Profile</a></li>
                                  <li class="divider"></li>
                                  <li><a href="#">Sign Out</a></li>
                                </ul>
                              </div>-->

                    <div class="nav-collapse">
                        <ul class="nav">
                            <li><a href="acesso.jsp"> Acesso </a></li>
                            <li><a href="contato.jsp">Contato</a></li>
                            <li><a href="restritologin.jsp">Restrito</a></li>
                        </ul>

                    </div><!--/.nav-collapse -->
                </div>
            </div>
        </div>

        <div class="container-fluid">
            <div class="row-fluid">
                <div class="span3">
                    <div class="well sidebar-nav">
                        <ul class="nav nav-list">
                            <li class="nav-header">Cadastros</li>
                            <li><a href="associado.jsp">Associados</a></li>
                            <li><a href="dependente.jsp">Dependentes</a></li>
                            <li><a href="sepultado.jsp">Sepultado</a></li>
                            <li><a href="loculo.jsp">Lóculo</a></li>
                            <li><a href="servfunc.jsp">Serviço Funerário</a></li>
                            <li class="nav-header">Relatórios</li>
                           <li><a href="associado.jsp?listar=listar">Associados</a></li>
                            <li><a href="dependente.jsp?listar=listar">Dependentes</a></li>
                            <li><a href="sepultado.jsp?listar=listar">Sepultado</a></li>
                            <li><a href="loculo.jsp?listar=listar">Lóculo</a></li>
                            <li><a href="servfunc.jsp?listar=listar">Serviço Funerário</a></li>

                        </ul>
                    </div><!--/.well -->
                </div><!--/span-->
                <div class="span9">
                    <div class="hero-unit">
                    </div>
                    <div class="row-fluid">
                        <div class="span9">
                            <%
                                try {
                                    if (request.getParameter("listar") == null) {
                            %>
                            <form name="frmsf" class="well">
                                <fieldset>
                                    <legend><h2>Serviço Funerário</h2></legend>
                                <%--<label>Codigo Serviço Funerário</label>
                                <input type="text" class="span3"name="codigo">--%>
                                <label>Nome do Serviço</label>
                                <input type="text" class="span3"name="nome">
                                <label>Quantidade de Serviço</label>
                                <input type="text" class="span3"name="qtd">
                                <label>Valor do Serviço</label>
                                <input type="text" class="span3"name="valor">
                                <label>Código do Associado</label>
                                <input type="text" class="span3"name="cd_associado">
                                <button type="button" onclick="di()" class="btn">Cadastrar</button>
                               <%-- <a href="?listar=listar" class="btn">Listar Todos</a>--%>
                               </fieldset>
                            </form>
                            <% } else if (request.getParameter("listar").equals("listar")) {
                                ServfunDAO sfdao = new ServfunDAO();
                                List<servicoFunerario> lis = sfdao.getLista();
                            %>

                            <div class="row">
                                <div class="span12" align="center">
                                    <h2>Serviço Funerário</h2>
                                    <table class="table table-striped">
                                        <thead>
                                            <tr>
                                                <th>ID</th>
                                                <th>Serviço</th>
                                                <th>Quantidade</th>
                                                <th>Valor</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <% for (int i = 0; i < lis.size(); i++) {
                                                    servicoFunerario sf = lis.get(i);
                                            %>
                                            <tr>
                                                <td><%= sf.getId()%></td>
                                                <td><%= sf.getNome()%></td>
                                                <td><%= sf.getQuantidade()%></td>
                                                <td><%= sf.getValor()%></td>
                                            </tr>
                                            <%
                                                }
                                            %>
                                        </tbody>
                                    </table>
                                    <a href="servfunc.jsp" class="btn btn-success">Voltar</a>
                                </div>
                            </div>

                            <% } else {
                                        //Loculo a = new Loculo(Integer.parseInt(request.getParameter("id")), request.getParameter("nome"), request.getParameter("rg"), request.getParameter("estado"), request.getParameter("cpf"), request.getParameter("titulo"), request.getParameter("sexo"), request.getParameter("filiacao"), request.getParameter("data"), request.getParameter("endereco"), request.getParameter("cidade"), request.getParameter("cep"), Integer.parseInt(request.getParameter("cdfunc")));
                                        //  Loculo a = new Loculo(Integer.parseInt(request.getParameter("id")), request.getParameter("rua"), request.getParameter("desc"), Integer.parseInt(request.getParameter("cd_associado")));
                                        // LoculoDAO da = new LoculoDAO();
                                        // da.cadastrar(a);
                                        // out.println("CADASTRADO COM SUCESSO!");
                                    }
                                } catch (Exception e) {
                                    out.println(e.getMessage());
                                } finally {
                                }
                            %>




                        </div><!--/span-->
                    </div><!--/row-->
                </div><!--/span-->
            </div><!--/row-->
            <hr>

            <footer>
                <p>© Company 2012</p>
            </footer>

        </div><!--/.fluid-container-->

        <!-- Le javascript
        ================================================== -->
        <!-- Placed at the end of the document so the pages load faster -->
        <script src="fluid_arquivos/jquery.js"></script>
        <script src="fluid_arquivos/bootstrap-transition.js"></script>
        <script src="fluid_arquivos/bootstrap-alert.js"></script>
        <script src="fluid_arquivos/bootstrap-modal.js"></script>
        <script src="fluid_arquivos/bootstrap-dropdown.js"></script>
        <script src="fluid_arquivos/bootstrap-scrollspy.js"></script>
        <script src="fluid_arquivos/bootstrap-tab.js"></script>
        <script src="fluid_arquivos/bootstrap-tooltip.js"></script>
        <script src="fluid_arquivos/bootstrap-popover.js"></script>
        <script src="fluid_arquivos/bootstrap-button.js"></script>
        <script src="fluid_arquivos/bootstrap-collapse.js"></script>
        <script src="fluid_arquivos/bootstrap-carousel.js"></script>
        <script src="fluid_arquivos/bootstrap-typeahead.js"></script>



    </body></html>